<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="/resources/js/jquery-1.11.1.min.js"></script>
    <script src="/resources/js/self.js"></script>
    <script type="text/javascript" src="/resources/js/md5.js"></script>
    <script type="text/javascript" src="/resources/My97DatePicker/WdatePicker.js"></script>
    <script type="text/javascript" src="/resources/js/ajaxfileupload.js"></script>
    <script type="text/javascript" src="/resources/js/Util.js"></script>
    <link href="/resources/css/fk_ymm.css?r=1" rel="stylesheet">
</head>
<body>
<div style="height: 65px;width: 100%">

</div>

<div   class="row form-inline" style="margin-left: 20px;margin-top: 10px;">
    <button type="button" onclick="showRegister()" class="btn btn-success">企业备案审核</button>
    <button type="button" onclick="back()" class="btn btn-success" style="float:right;margin-right:20px;">返回</button>
</div>
<div class="row">
    <div style="background-color: #fff;padding: 3px;">
        <table style="width:100%;">
            <!--<tr>-->
                <!--<td colspan="9">-->
                    <!--<button onclick="back()" class="btn btn-success" style="float: right;margin-right: 20px;">返回</button>-->
                <!--</td>-->


            <!--</tr>-->

            <tr>
                <td class="name" >
                    名称：
                </td>
                <td>
                    <input type="text" name="name"   id="name"
                           class="form-control form-data ">
                    <input type="hidden" name="id" class="form-data">
                </td>
                <td class="name">
                    行业：
                </td>
                <td>
                    <input type="text" name="business" id="business"
                           class="form-control form-data ">
                </td>
                <td class="name">
                    企业所在地：
                </td>
                <td>
                    <input type="text" name="companyAddress" id="companyAddress"
                           class="form-control form-data ">
                </td>
                <td class="name">
                    建立时间：
                </td>
                <td>
                    <input type="text" name="startTime" id="startTime"
                           class="form-control form-data " onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})">
                </td>
            </tr>
            <tr>
                <td class="name" >
                    法人：
                </td>
                <td>
                    <input type="text" name="chargePeople" id="chargePeople"
                           class="form-control form-data ">
                </td>
                <td class="name">
                    性别：
                </td>
                <td>
                    <select name="sex" class="form-control form-data col-md-7 col-xs-12">
                        <option value="男">男</option>
                        <option value="女">女</option>
                        <option value="保密">保密</option>
                    </select>
                </td>
                <td class="name">
                    身份证号：
                </td>
                <td>
                    <input type="text" id="idCard" name="idCard"
                           class="form-control form-data ">
                </td>
                <td class="name">
                    联系方式：
                </td>
                <td>
                    <input type="text" id="telephone" name="telephone"
                           class="form-control form-data ">
                </td>
            </tr>
            <tr>
                <td class="name" >
                    法人地址：
                </td>
                <td colspan="3">
                    <input type="text" id="personAddress" name="personAddress"
                           class="form-control form-data ">
                </td>
                <td class="name">
                    企业状态：
                </td>
                <td colspan="3">
                    <input style="width:15px;height:15px" type="radio" name="status" class="form-data"
                           value="inProduction"/>
                    <span>生产</span>
                    <input style="width:15px;height:15px" type="radio" name="status" class="form-data"
                           value="discontinued"/>
                    <span>停产</span>
                    <input style="width:15px;height:15px" type="radio" name="status" class="form-data"
                           value="suspend"/>
                    <span>停业整顿</span>
                    <input style="width:15px;height:15px" type="radio" name="status" class="form-data"
                           value="closed"/>
                    <span>注销</span>
                </td>
            </tr>
            <tr>
                <td class="name" >
                    经理：
                </td>
                <td>
                    <input type="text" name="manager" id="manager"
                           class="form-control form-data ">
                </td>
                <td class="name">
                    性别：
                </td>
                <td>
                    <select name="managerSex" class="form-control form-data col-md-7 col-xs-12">
                        <option value="男">男</option>
                        <option value="女">女</option>
                        <option value="保密">保密</option>
                    </select>
                </td>
                <td class="name">
                    身份证号：
                </td>
                <td>
                    <input type="text" id="managerIdCard" name="managerIdCard"
                           class="form-control form-data ">
                </td>
                <td class="name">
                    经理电话：
                </td>
                <td>
                    <input type="text" id="managerTel" name="managerTel"
                           class="form-control form-data ">
                </td>
            </tr>
            <tr>
                <td class="name" >
                    经理地址：
                </td>
                <td colspan="7">
                    <input type="text" id="managerAddress" name="managerAddress"
                           class="form-control form-data ">
                </td>
            </tr>

            <tr>
                <td class="name" colspan="3">
                    法人照片
                    <button onclick="$('#fileUploadLegalPersonPhotos').click()" class="btn btn-success">上传文件
                    </button>
                    <input type="file" name="file" multiple="true" accept="image/*"
                           id="fileUploadLegalPersonPhotos" style="display:none"
                           onchange="uploadFile('fileUploadLegalPersonPhotos','legalPersonPhotos', 'imgDiv2', 100, 100,'image')"/>
                </td>
                <td class="name" colspan="3">
                    实景图片
                    <button id="uploadBtn" onclick="$('#fileUpload').click()" class="btn btn-success">上传文件
                    </button>
                    <input type="file" name="file" multiple="true" accept="image/*" id="fileUpload"
                           style="display:none"
                           onchange="uploadFile('fileUpload','image', 'imgDiv', 100, 100,'image')"/>

                </td>
                <td class="name" colspan="3">
                    制度汇编
                    <button class="btn btn-success" onclick="$('#file_input').click();">
                        上传文件
                    </button>

                    <input type="file" id="file_input" name="file" onchange="uploadFileId('file')"
                           value="Upload your resume"
                           style="opacity: 0;width: 0px;display: none">

                </td>
            </tr>
            <tr>

                <td colspan="3" style="text-align: center">
                    <div id="imgDiv2" style="padding-top: 23px">
                        <img src="" style="cursor: pointer; width:100px;height: 100px"
                             onclick="deleteImage(event,this)" title=""/>
                    </div>
                </td>
                <td colspan="3" style="text-align: center">
                    <div id="imgDiv" style="padding-top: 23px">
                        <img src="" style="cursor: pointer; width:100px;height: 100px"
                             onclick="deleteImage(event,this)" title=""/>
                    </div>
                </td>
                <td colspan="3" style="text-align: center">
                    <div id="file_div" style="margin-top: 20px;">
                    </div>
                </td>
            </tr>

            <tr>
                <td class="name" >
                    企业简介：
                </td>
                <td colspan="7">
                    <textarea class="form-control form-data" name="desc" rows="3" placeholder=""></textarea>
                </td>
            </tr>
            <!--<tr>-->
                <!--<td colspan="9">-->
                    <!--<button onclick="back()" class="btn btn-success">返回</button>-->
                <!--</td>-->


            <!--</tr>-->

        </table>
    </div>

</div>
</body>
<script type="text/javascript">
    $(function () {
        setTitle("运输公司");
        initData();
    });

    function initData(){
        var data = getData();
        var id = data.id;
        if(null2empty(id) !==""){
            $("input[name='id']").val(id);
            $.ajax({
                url:"/admin/transportCompany/find.do",
                data:{'id':id},
                type:'post',
                dataType:'json',
                success:function(data){
                    console.log(data);
                    if(data.success){
                        initPageDate(data.data, '.form-data');
                        $("#imgDiv img").attr("src", data.data.image);
                        $("#imgDiv2 img").attr("src", data.data.legalPersonPhotos);
                        $("#imgDiv3 img").attr("src", data.data.processImage);
                        $("#imgDiv4 img").attr("src", data.data.equationImage);
                        addFileInfoToTable(data.data.fileInfoList, 'file');
                    }
                }
            });
            $("#account").attr('readonly','readonly');
        }

    }
    function showRegister() {
        var data = getData();
        var companyId =  data.id;
        if(isNullOrUndefined(companyId)){
            alert("请选择要修改的数据,并且只能选择一条");
            return;
        }
        goto("companyRegister_show.html",{"companyId":companyId,"back_url":"trans_r_list.html","data_type":'trans'});
    }
    function uploadFile(fileType) {
        $.ajaxFileUpload({
            url: "/file/uploadFile.do?_t=" + new Date().getTime(),            //需要链接到服务器地址
            secureuri: false,//是否启用安全提交，默认为false
            fileElementId: fileType+'_input',                        //文件选择框的id属性
            dataType: 'text',                                     //服务器返回的格式，可以是json, xml
            success: function (data, status) {//服务器成功响应处理函数
                var rpeObj = $.parseJSON(data);
                var fileInfoList = rpeObj.data;
                addFileInfoToTable(fileInfoList,fileType);

            }
        });
    }
    function addFileInfoToTable(fileInfoList,fileType){
        $(fileInfoList).each(function(index,file){
            var fileHtml = "<div  style='border-radius: 2px; width:48%;height:399px;float: left; border: 2px #ffffff solid;'>"+
                "<div style='height:317px;overflow:hidden'><img class='image' style='height:auto;width:100%;' src='"+getFileShowUrl(file.path)+"'></div>"+

                "<div align='center' style='height:80px;margin-bottom: 0px;'>"+
                "<div align='center' style='word-wrap:break-word'><input type='hidden' name='"+fileType+"_id' value='"+file.id+"'>"+file.name+"</div>"+
            "</div>";
            $(fileHtml).appendTo($("#"+fileType+"_div"));

        });
        $('.image').viewer();
    }
    //获取要展示的图片
    function getFileShowUrl(url){
        var extStart=url.lastIndexOf(".");
        var ext=url.substring(extStart,url.length).toUpperCase();
        if(ext!=".BMP"&&ext!=".PNG"&&ext!=".GIF"&&ext!=".JPG"&&ext!=".JPEG"){
            return "/resources/images/timg.jpg";
        }else{
            return url;
        }
    }
    function back() {
        var localData = getData();
        goto(localData.back_url,{'id':localData.saleOrderId,"process":localData.process,"refuseFlag":localData.refuseFlag});
    }
</script>
</html>